<template>
	<view class="shaft" style="background-color: #fff;padding-top: 20rpx;height:100%">
		<view style="font-size: 30rpx;padding-left: 35rpx;padding-bottom: 40rpx;font-weight: bold;">必选条件</view>
		<uni-row class="uni-row" style="margin-top: 30rpx;">
			<uni-col :span="12">
				<view class=" flex jbetween mb40" style="padding-left: 20rpx;">
					<text class="uni-tag-left font20  flex1" style=""><text class="textColor"
							style="font-size: 30rpx;">*</text>
						载重kg</text>
					<view v-if="entity.E_Load" class="uni-tag-right active" style="color:#000"
						:class="{ 'noneActive': options.title === '查看' }"
						@click="PopupCheckboxsClick(entity, 'E_Load', '载重kg')">
						{{ entity.E_Load }}
					</view>
					<view v-else class="uni-tag-right" style="color:red"
						:class="{ 'noneActive': options.title === '查看' }"
						@click="PopupCheckboxsClick(entity, 'E_Load', '载重kg')">未选择
					</view>
				</view>
			</uni-col>
			<uni-col :span="12">
				<view class="flex jbetween mb40" style="padding-left: 20rpx;">
					<text class="uni-tag-left font20  flex1" style=""><text class="textColor"
							style="font-size: 30rpx;">*</text>
						梯速m/s</text>
					<view v-if="entity.E_Speed" class="uni-tag-right active" style="color:#000"
						:class="{ 'noneActive': options.title === '查看' }"
						@click="PopupCheckboxsClick(entity, 'E_Speed', '梯速m/s')">
						{{ entity.E_Speed }}
					</view>
					<view v-else class="uni-tag-right" style="color:red"
						:class="{ 'noneActive': options.title === '查看' }"
						@click="PopupCheckboxsClick(entity, 'E_Speed', '梯速m/s')">未选择
					</view>
				</view>
			</uni-col>
		</uni-row>
		<uni-row class="uni-row">
			<uni-col :span="12">
				<view class="flex jbetween mb40" style="padding-left: 20rpx;">
					<text class="uni-tag-left font20  flex1" style=""><text class="textColor"
							style="font-size: 30rpx;">*</text>
						机房类型</text>
					<view v-if="entity.E_RoomType" class="uni-tag-right active" style="color:#000"
						:class="{ 'noneActive': options.title === '查看' }"
						@click="PopupCheckboxsClick(entity, 'E_RoomType', '机房类型')">
						{{ entity.E_RoomType }}
					</view>
					<view v-else class="uni-tag-right" style="color:red"
						:class="{ 'noneActive': options.title === '查看' }"
						@click="PopupCheckboxsClick(entity, 'E_RoomType', '机房类型')">
						未选择</view>
				</view>
			</uni-col>
			<uni-col :span="12">
				<view class="flex jbetween mb40" style="padding-left: 20rpx;">
					<text class="uni-tag-left font20  flex1" style=""><text class="textColor"
							style="font-size: 30rpx;">*</text>
						轿厢类型</text>
					<view v-if="entity.E_LiftCarType" class="uni-tag-right active" style="color:#000"
						:class="{ 'noneActive': options.title === '查看' }"
						@click="PopupCheckboxsClick(entity, 'E_LiftCarType', '轿厢类型')">
						{{ entity.E_LiftCarType }}
					</view>
					<view v-else class="uni-tag-right" style="color:red"
						:class="{ 'noneActive': options.title === '查看' }"
						@click="PopupCheckboxsClick(entity, 'E_LiftCarType', '轿厢类型')">未选择</view>
				</view>
			</uni-col>
		</uni-row>
		<uni-collapse accordion class="xuantian">
			<uni-collapse-item title="123">
				<view slot="title" style="padding: 30rpx 30rpx;font-weight: 600;">选填条件<span
						style="color: #d1100b;margin-left: 5rpx; font-size: 25rpx;">(可展开)</span></view>
				<view class="" style="font-size: 26rpx;color:#ccc;padding: 10rpx 20rpx;">
					(注：轿厢面积校验基于轿厢宽度和轿厢深度均填写后校验，默认不填写为：校验成功)
				</view>
				<view class="" style="text-align: right;padding-bottom: 10rpx;" @click="resetSelectClick">
					<button size="mini"
						style="background-color: #d1100b;color:#fff;font-size: 30rpx;margin-right: 20rpx;">全部重置</button>
				</view>

				<uni-row class="uni-row">
					<uni-col :span="12">
						<view class="flex jbetween mb40" style="padding-left: 20rpx;">
							<text class="uni-tag-left font20  flex1" style="">对重类型</text>
							<view v-if="entity.E_CounterWeight" class="uni-tag-right active" style="color:#000"
								:class="{ 'noneActive': options.title === '查看' }"
								@click="PopupCheckboxsClick(entity, 'E_CounterWeight', '对重类型')">
								{{ entity.E_CounterWeight }}
							</view>
							<view v-else class="uni-tag-right" style="color:red"
								:class="{ 'noneActive': options.title === '查看' }"
								@click="PopupCheckboxsClick(entity, 'E_CounterWeight', '对重类型')">未选择</view>
						</view>
					</uni-col>
					<uni-col :span="12">
						<view class="flex jbetween mb40" style="padding-left: 20rpx;">
							<text class="uni-tag-left font20  flex1" style="">开门方式</text>
							<view v-if="entity.E_OpenDoorMode" class="uni-tag-right active" style="color:#000"
								:class="{ 'noneActive': options.title === '查看' }"
								@click="PopupCheckboxsClick(entity, 'E_OpenDoorMode', '开门方式')">
								{{ entity.E_OpenDoorMode }}
							</view>
							<view v-else class="uni-tag-right" style="color:red"
								:class="{ 'noneActive': options.title === '查看' }"
								@click="PopupCheckboxsClick(entity, 'E_OpenDoorMode', '开门方式')">未选择</view>
						</view>
					</uni-col>
				</uni-row>
				<uni-row class="uni-row">
					<uni-col :span="12">
						<view class="flex jbetween mb40" style="padding-left: 20rpx;">
							<text class="uni-tag-left font20  flex1" style="">轿厢宽mm</text>
							<view v-if="entity.E_LiftCarWidth" class="uni-tag-right active" style="color:#000"
								:class="{ 'noneActive': options.title === '查看' }"
								@click="CustomPopupClick(entity, 'E_LiftCarWidth', '轿厢宽')">{{ entity.E_LiftCarWidth }}
							</view>
							<view v-else class="uni-tag-right" style="color:red"
								:class="{ 'noneActive': options.title === '查看' }"
								@click="CustomPopupClick(entity, 'E_LiftCarWidth', '轿厢宽')">未选择</view>
						</view>
					</uni-col>
					<uni-col :span="12">
						<view class="flex jbetween mb40" style="padding-left: 20rpx;">
							<text class="uni-tag-left font20  flex1" style="">轿厢深mm</text>
							<view v-if="entity.E_LiftCarDepth" class="uni-tag-right active" style="color:#000"
								:class="{ 'noneActive': options.title === '查看' }"
								@click="CustomPopupClick(entity, 'E_LiftCarDepth', '轿厢深')">{{ entity.E_LiftCarDepth }}
							</view>
							<view v-else class="uni-tag-right" style="color:red"
								:class="{ 'noneActive': options.title === '查看' }"
								@click="CustomPopupClick(entity, 'E_LiftCarDepth', '轿厢深')">未选择</view>
						</view>
					</uni-col>
				</uni-row>
				<uni-row class="uni-row">
					<uni-col :span="12">
						<view class="flex jbetween mb40" style="padding-left: 20rpx;">
							<text class="uni-tag-left font20  flex1" style="">轿厢净高mm</text>
							<view v-if="entity.E_LiftCarNetHeight" class="uni-tag-right active" style="color:#000"
								:class="{ 'noneActive': options.title === '查看' }"
								@click="CustomPopupClick(entity, 'E_LiftCarNetHeight', '轿厢净高')">
								{{ entity.E_LiftCarNetHeight }}
							</view>
							<view v-else class="uni-tag-right" style="color:red"
								:class="{ 'noneActive': options.title === '查看' }"
								@click="CustomPopupClick(entity, 'E_LiftCarNetHeight', '轿厢净高')">未选择</view>
						</view>
					</uni-col>
					<uni-col :span="12">
						<view class="flex jbetween mb40" style="padding-left: 20rpx;">
							<text class="uni-tag-left font20  flex1" style="">提升高度m</text>
							<view v-if="entity.E_MaxLiftHeight" class="uni-tag-right active" style="color:#000"
								:class="{ 'noneActive': options.title === '查看' }"
								@click="CustomPopupClick(entity, 'E_MaxLiftHeight', '提升高度')">
								{{ entity.E_MaxLiftHeight }}
							</view>
							<view v-else class="uni-tag-right" style="color:red"
								:class="{ 'noneActive': options.title === '查看' }"
								@click="CustomPopupClick(entity, 'E_MaxLiftHeight', '提升高度')">未选择</view>
						</view>
					</uni-col>
				</uni-row>
				<!-- <uni-row class="uni-row">
					<uni-col :span="12">
						<view class="flex jbetween mb40" style="padding-left: 20rpx;">
							<text class="uni-tag-left font20  flex1" style="">开门宽</text>
							<view v-if="entity.E_LiftCarDoorW" class="uni-tag-right active" style="color:#000"
								:class="{'noneActive' : options.title==='查看'}"
								@click="CustomPopupClick(entity,'E_LiftCarDoorW', '开门宽')">{{entity.E_LiftCarDoorW}}</view>
							<view v-else class="uni-tag-right" style="color:red" :class="{'noneActive' : options.title==='查看'}"
								@click="CustomPopupClick(entity,'E_LiftCarDoorW', '开门宽')">未选择</view>
						</view>
					</uni-col>
					<uni-col :span="12">
						<view class="flex jbetween mb40" style="padding-left: 20rpx;">
							<text class="uni-tag-left font20  flex1" style="">开门高</text>
							<view v-if="entity.E_LiftCarDoorH" class="uni-tag-right active" style="color:#000"
								:class="{'noneActive' : options.title==='查看'}"
								@click="CustomPopupClick(entity,'E_LiftCarDoorH', '开门高')">{{entity.E_LiftCarDoorH}}</view>
							<view v-else class="uni-tag-right" style="color:red" :class="{'noneActive' : options.title==='查看'}"
								@click="CustomPopupClick(entity,'E_LiftCarDoorH', '开门高')">未选择</view>
						</view>
					</uni-col>
				</uni-row> -->
				<uni-row class="uni-row">
					<uni-col :span="12">
						<view class="flex jbetween mb40" style="padding-left: 20rpx;">
							<text class="uni-tag-left font20  flex1" style="">轿厢面积校验</text>
							<view class="uni-tag-right" style="border:none">
								<view v-if="isValidateLiftCarArea"
									style="display: flex;align-items: center;padding-left: 10rpx;">
									<uni-icons type="checkbox" size="15" color="#42B983"> </uni-icons>
									<text style="font-size: 25rpx;color:#42B983;font-weight: bold;">校验成功</text>
								</view>
								<view v-else style="display: flex;align-items: center;padding-left: 10rpx;">
									<uni-icons type="close" size="15" color="#d1100b"></uni-icons>
									<text style="font-size: 25rpx;color:#d1100b;font-weight: bold;">校验失败</text>
								</view>
							</view>
						</view>
					</uni-col>
				</uni-row>
				<!-- <uni-col :span="12">
					<view class="jbetween flex  mb40" style="padding-left: 20rpx;">
						<UniTag :inverted="true" text="最大停站数" :customStyle="customStyle" />
						<text v-if="entity.E_MaxStop" class=" font20  flex1"
							style="text-align: center;" @click="$refs.PopupCheckboxs.open(entity, 'E_MaxStop')">{{ entity.E_MaxStop}}</text>
						<text v-else class=" font20  flex1" style="text-align: center;color:#D1100B"
							@click="$refs.PopupCheckboxs.open(entity, 'E_MaxStop')">未选择</text>
					</view>
				</uni-col> -->
			</uni-collapse-item>
		</uni-collapse>
		<!-- 查询 -->
		<view class="flex jbetween" style="margin: 20rpx;">
			<!-- :class="{ 'active':tableData.length ==0 }" -->
			<view class="" style="display: flex;width: 100%;">
				<view style="flex:5;display: flex;justify-content: flex-start;">
					<view v-if="options.title === '新建' && tableData.length !== 0" class="addbutton"
						style=" padding:15rpx 30rpx;font-size: 30rpx;width: 180rpx;text-align: center;border-radius: 10rpx;"
						type="primary" size="large" @click="addColectClick">加入收藏项目</view>
				</view>
				<view style="flex:5;display: flex;justify-content: flex-end;">
					<view v-if="options.title === '查看'">
						<view v-if="!options.share" class="addbutton"
							style=" padding:15rpx 30rpx;font-size: 30rpx;text-align: center;border-radius: 10rpx;"
							type="primary" size="large" @click="addColectClick">保存</view>
					</view>
					<view style='margin-left: 5px;' :class="{ 'backActive': !isValidateLiftCarArea }" class="search"
						type="primary" size="mini" @click="searchClick">{{ isValidateLiftCarArea ? "查询" : "轿厢面积校验失败" }}
					</view>
				</view>
			</view>


		</view>
		<view class="" style="padding-bottom: 200rpx;background: #fff;">
			<!-- 表格组件：参数解释：@getTextColor：调用方法判断数据后返回对比颜色，可以改变单元格文字的颜色 -->
			<!-- @getEdit：点击表格中编辑按钮会触发的方法  @getDelete：点击表格中删除按钮会触发的方法  @scrollBottom：滚动到底部时触发 @rowData：获取点击行的数据-->
			<!-- data：列表数据，格式和elementul表格一样，head：表头数据，格式[{name:'列名',key:'对应列表的key',bgcolor:1代表这一列添加背景色,flxe:1代表这一列固定}],tableHeight:表格表体高度 -->
			<UaTable @scrollBottom='scrollBottom' @getTextColor='getRedText' @getDelete='deleteTable' @rowData='getRow'
				:data2='tableData' :head='header' :tableHeight='310'>
			</UaTable>
			<!-- 查询 -->
			<view v-if="resetShow" class="cate-btnBox" style="background-color: #fff;">
				<button class="btn" style="background-color: #D1100B;padding:4rpx 30rpx;font-size: 30rpx;"
					type="primary" size="large" @click="resetClick">重置计算列表</button>
			</view>
			<!-- 底部弹窗 -->
			<PopupCheckboxs ref="PopupCheckboxs" @subclickRow="subclickRow"></PopupCheckboxs>
			<!-- 给轿厢宽高用 -->
			<CustomPopup ref="CustomPopup" @customSubmit="customSubmit" :title="title"></CustomPopup>
			<UaPopup ref="UaPopup" :parentObj="{ ...this }"></UaPopup>
			<!-- <uni-popup-message type="warn" :message="messageText" :duration="2000"></uni-popup-message> -->
		</view>
	</view>
</template>

<script>
	// 公共底部弹窗
	import PopupCheckboxs from "../../component/PopupCheckboxs.vue"
	import CustomPopup from "../../component/CustomPopup.vue"
	import UaPopup from "../../component/UaPopup.vue"
	// 表格
	import UaTable from "../../component/ua-table.vue"
	import {
		ValidateLiftCarArea, //轿厢面积校验
		ElevatorSampleInfoSuggestValue, //查询井道计算
		Elevator_Temp_QSRMSaveData, //加入收藏列表
		TheDataAndDetail, //查看井道详情
		TheDataAndDetailForShare //查看井道详情不需要token
	} from "../interface.js"
	export default {
		components: {
			UaTable,
			PopupCheckboxs,
			CustomPopup,
			UaPopup
		},
		data() {
			return {
				title: "", //CustomPopup弹窗的标题
				messageText: "这是一条警告",
				value: '关键词',
				isPublicPopup: false,
				// 标签样式
				customStyle: 'width:150rpx;display:inline-block;text-align:center',
				//表体
				tableData: [],
				//表头
				header: [{
						name: '    品牌-系列    ',
						key: 'E_Brand',
						flxe: 1 //固定的列，只能有一个列
					},
					// {
					// 	name: '系列',
					// 	key: 'E_Series',
					// 	bgcolor: 1 //列底纹

					// },
					{
						name: '井道宽度',
						key: 'E_ShaftWidth'
					}, {
						name: '井道深度',
						key: 'E_ShaftDepth'
					}, {
						name: '顶层高度',
						key: 'E_TopHeight'
					},
					{
						name: '底坑深度',
						key: 'E_BottomDepth'
					},
					// {
					// 	key: "E_Load",
					// 	name: "载重"
					// }, {
					// 	key: "E_Speed",
					// 	name: "梯速"
					// },
					// {
					// 	key: "E_RoomType",
					// 	name: "机房类型"
					// }, {
					// 	key: "E_LiftCarType",
					// 	name: "轿厢类型"
					// },
					{
						key: "E_CounterWeight",
						name: "对重类型"
					},
					{
						key: "E_OpenDoorMode",
						name: "开门方式"
					},
					// {
					// 	key: "E_LiftCarDoorW",
					// 	name: "开门宽"
					// },
					// {
					// 	key: "E_LiftCarDoorH",
					// 	name: "开门高"
					// },
					{
						key: "E_LiftCarWidth",
						name: "轿厢宽度"
					},
					{
						key: "E_LiftCarDepth",
						name: "轿厢深度"
					},
					{
						key: "E_MaxLiftHeight",
						name: "最大提升高度"
					},
					// {
					// 	key: "E_MaxLiftHeight(m)",
					// 	name: "最大提升高度"
					// }, 
					{
						name: '操' + '\n' + '作',
						key: 'edit',
						flex: 1,
						hWidth: 100
					}
				],
				entity: {}, // 顶部标签数据
				newEntity: {},
				isValidateLiftCarArea: true, //轿厢面积校验
				newTableData: [],
				arrTableData: [],
				resultData: [],
				options: {},
				isErrorLiftHeight: false,
				newQSRDDetailsList: [],
				resetShow: false,
			}
		},
		onLoad(options) {
			this.options = options
			console.log('获取查看详情----------------', this.options)
			if (options.Id) {
				if (options.share) return this.getTheDataAndDetailForShare(options.Id) //判断如果是分享的话就不需要token 
				else this.getTheDataAndDetail(options.Id) //需要token
				this.resetShow = true;
			} else {
				uni.removeStorageSync('tableData')
				this.resetShow = false;
			}

		},
		onUnload() {
			// 判断options中是否存在分享  如果存在分享 清空缓存token避免分享过的用户持续获取到数据  
			// if(this.options.share) 	uni.removeStorageSync('token')

		},
		onShow() {
			// uni.removeStorageSync('tableData')
			// uni.removeStorageSync('newTableData')
		},
		// computed:{
		// 	resetShow(){
		// 		this.initialData = uni.getStorageSync('tableData')
		// 		return this.initialData;
		// 	}	
		// },
		methods: {
			// 自定义事件方法，业务逻辑判断是否需要标红，然后回调给子组件颜色
			getRedText(row, col, callback) {
				// console.log('自定义事件方法getRedText', row, col)
				let color = 'black'
				if (row.E_Brand === '推荐值') {
					color = "#fff !important"
				}
				// 判断值是否需要标红
				if (row.ECW_Prominent == 1) { // 判断对重类型
					if (row[col.key] === '侧对重' || row[col.key] === '后对重' || row[col.key] === '后置式') {
						color = "red"
					} else color = 'black'
				} else if (row.EOM_Prominent == 1) { // // 判断开门方式
					if (row[col.key] === '中分' || row[col.key] === '旁开') {
						color = "red"
					} else color = 'black'
				}
				// 通过回调函数返回值
				callback(color);
			},
			// 必选条件弹窗
			PopupCheckboxsClick(entity, type, title) {
				// if (this.options.title === '查看') return //查看条件不支持
				this.$refs.PopupCheckboxs.open(entity, type, title)
			},
			// 选填条件弹窗
			CustomPopupClick(entity, type, title) {
				// if (this.options.title === '查看') return //查看条件不支持
				this.$refs.CustomPopup.open(entity, type, title)
			},
			// 选填条件重置
			resetSelectClick() {
				this.entity.E_CounterWeight = null //对重类型清空
				this.entity.E_OpenDoorMode = null //开门方式清空
				this.entity.E_MaxLiftHeight = null //提升高度清空
				this.entity.E_LiftCarDoorH = null //开门高度清空
				this.entity.E_LiftCarDoorW = null //开门宽度清空
				this.entity.E_LiftCarNetHeight = null //轿厢净高清空
				this.entity.E_LiftCarWidth = null //轿厢宽度清空
				this.entity.E_LiftCarDepth = null //轿厢深度清空
			},
			//重置结果
			resetClick() {
				// 非空校验
				if (!this.entity.E_Load) return this.$util.toast('请选择载重')
				if (!this.entity.E_Speed) return this.$util.toast('请选择梯速')
				if (!this.entity.E_RoomType) return this.$util.toast('请选择机房类型')
				if (!this.entity.E_LiftCarType) return this.$util.toast('请选择轿厢类型')
				// if (this.options.title === "查看") {
				// 	if(this.options.share) return this.getTheDataAndDetailForShare(this.options.Id)
				// 	this.getTheDataAndDetail(this.options.Id)
				// } else {
				// 	this.GetElevatorSampleInfoSuggestValue()
				// }
				let tableData = uni.getStorageSync('tableData');
				tableData.forEach(item => {
					item.IsShow = 1;
				})
				this.tableData = tableData
				this.arrTableData = JSON.parse(JSON.stringify(this.tableData))
				this.newTableData.QSRDDetailsList = this.tableData;
				this.recommendMax(this
					.tableData)
			},
			// 删除按钮
			deleteTable(val, index) {},
			// 滚动到底部
			scrollBottom() {
				// uni.showToast({
				// 	title: '滚动到底部了'
				// })
				console.log('滚动到底部了');
			},
			//获取行的数据 移除计算
			getRow(row, index) {
				this.tableData.splice(index, 1)
				var newTableData = []
				if (this.options.title === '查看') {
					newTableData = this.arrTableData
					newTableData[row.newId].IsShow = 0
				} else {
					newTableData = this.newTableData
					newTableData[row.newId].IsShow = 0
				}
				this.resultData = newTableData

				console.log('移除计算了---', this.options.title, this.tableData, this.resultData, this.entity)
				if (this.options.title === '查看') {
					this.recommendMax(this.resultData, '删除')
				} else {
					this.recommendMax(this.resultData, '删除')
					// this.GetElevatorSampleInfoSuggestValue()
				}

			},
			// 轿厢宽高底部弹窗回调函数
			customSubmit(data, type) {
				this.$set(this.entity, type, data)
				console.log('sutompop參數', data, type, this.entity)
				var that = this
				if (this.entity.E_Load && this.entity.E_LiftCarWidth && this.entity.E_LiftCarDepth) {
					ValidateLiftCarArea({
						E_Load: Number(this.entity.E_Load),
						E_LiftCarWidth: Number(this.entity.E_LiftCarWidth),
						E_LiftCarDepth: Number(this.entity.E_LiftCarDepth)
					}).then(res => {
						if (res.Success) {
							that.isValidateLiftCarArea = res.Data
							if (!res.Data) {
								that.$util.toast('轿厢面积校验不通过, 请重新输入轿厢宽高载重进行校验')
								// 延迟初始化为搜索按钮
								setTimeout(function() {
									that.isValidateLiftCarArea = true
								}, 5000)
								return
							}
						}
					})
				}
			},
			// 底部弹窗返回函数
			subclickRow(data, type) {
				this.$set(this.entity, type, data.text)
			},
			// 加入收藏列表
			addColectClick() {
				// let Msg = this.options.title === '查看' ? '没有要保存的收藏列表, 请先查询' : '没有要加入的收藏列表, 请先查询'
				// if (this.tableData.length == 0) return this.$util.toast(Msg)
				this.entity.QSRDDetailsList = this.tableData
				// 非空校验
				if (!this.entity.E_Load) return this.$util.toast('请选择载重')
				if (!this.entity.E_Speed) return this.$util.toast('请选择梯速')
				if (!this.entity.E_RoomType) return this.$util.toast('请选择机房类型')
				if (!this.entity.E_LiftCarType) return this.$util.toast('请选择轿厢类型')
				// if (!this.entity.RecordName) { //如果有收藏名字  直接使用  否则 自动生成名字传递
				// 	this.entity.RecordName = '查井道_' + this.entity.E_Load + '_' + this.entity.E_Speed + '_' + this.entity
				// 		.E_RoomType +
				// 		'_' + this.entity.E_LiftCarType + '_' + this.$util.formatDate('day')
				// }
				// this.$refs.PublicPopup.open(this.entity) //修改收藏列表标题名称
				this.dialogInputConfirm() //加入收藏列表弹窗确定
			},
			//查询条件是否变更判断
			validateQueryCondition() {
				const errorMessage = [];
				if ((this.entity.E_Load ? this.entity.E_Load.toString() : '') !== (this.newEntity.E_Load ? this.newEntity
						.E_Load.toString() : '')) {
					errorMessage.push('载重')
				}
				if ((this.entity.E_Speed ? this.entity.E_Speed.toString() : '') !== (this.newEntity.E_Speed ? this
						.newEntity
						.E_Speed.toString() : '')) {
					errorMessage.push('梯速')
				}
				if ((this.entity.E_RoomType ? this.entity.E_RoomType.toString() : '') !== (this.newEntity.E_RoomType ? this
						.newEntity.E_RoomType.toString() : '')) {
					errorMessage.push('机房类型')
				}
				if ((this.entity.E_LiftCarType ? this.entity.E_LiftCarType.toString() : '') !== (this.newEntity
						.E_LiftCarType ?
						this.newEntity.E_LiftCarType.toString() : '')) {
					errorMessage.push('轿厢类型')
				}
				if ((this.entity.E_CounterWeight ? this.entity.E_CounterWeight.toString() : '') !== (this.newEntity
						.E_CounterWeight ? this.newEntity.E_CounterWeight.toString() : '')) {
					errorMessage.push('对重类型')
				}
				if ((this.entity.E_OpenDoorMode ? this.entity.E_OpenDoorMode.toString() : '') !== (this.newEntity
						.E_OpenDoorMode ? this.newEntity.E_OpenDoorMode.toString() : '')) {
					errorMessage.push('开门方式')
				}
				if ((this.entity.E_MaxLiftHeight ? this.entity.E_MaxLiftHeight.toString() : '') !== (this.newEntity
						.E_MaxLiftHeight ? this.newEntity.E_MaxLiftHeight.toString() : '')) {
					errorMessage.push('提升高度')
				}
				if ((this.entity.E_LiftCarNetHeight ? this.entity.E_LiftCarNetHeight.toString() : '') !== (this.newEntity
						.E_LiftCarNetHeight ? this.newEntity.E_LiftCarNetHeight.toString() : '')) {
					errorMessage.push('轿厢净高')
				}
				if ((this.entity.E_LiftCarWidth ? this.entity.E_LiftCarWidth.toString() : '') !== (this.newEntity
						.E_LiftCarWidth ? this.newEntity.E_LiftCarWidth.toString() : '')) {
					errorMessage.push('轿厢宽度')
				}
				if ((this.entity.E_LiftCarDepth ? this.entity.E_LiftCarDepth.toString() : '') !== (this.newEntity
						.E_LiftCarDepth ? this.newEntity.E_LiftCarDepth.toString() : '')) {
					errorMessage.push('轿厢深度')
				}
				if (errorMessage.length > 0) {
					this.$util.toast(`[${errorMessage.join('、')}]发生变化，无法保存，请先点击查询!`)
					return true;
				}
			},
			//加入收藏列表弹窗确定
			dialogInputConfirm(RecordName) {
				if (this.validateQueryCondition()) {
					return;
				}
				uni.showLoading({
					title: '加载中'
				})
				let params = {}
				if (this.options.title === "查看" || this.options.title === "新建") {
					console.log('this.result', this.resultData)
					// console.log('加入收藏列表了',data, this.options.title, this.resultData,  this.entity)
					if (this.resultData.length !== 0) {
						delete this.entity.QSRDDetailsList
						this.$set(this.entity, 'QSRDDetailsList', this.resultData) //更新表格列表重新赋值传递
					}

					var QSRDDetailsList = this.entity.QSRDDetailsList
					var newQSRDDetailsList = JSON.parse(JSON.stringify(QSRDDetailsList))
					this.newQSRDDetailsList = newQSRDDetailsList
					if (newQSRDDetailsList.length > 0 && newQSRDDetailsList[0].newId == null) {
						newQSRDDetailsList.splice(0, 1) //删除首元素 推荐列
					}
					console.log('删除元素', newQSRDDetailsList, this.entity.QSRDDetailsList, this.options.title)
					params = {
						AreaCheck: this.entity.AreaCheck,
						CreateTime: this.entity.CreateTime,
						CreatorId: this.entity.CreatorId,
						Deleted: this.entity.Deleted,
						E_CounterWeight: this.entity.E_CounterWeight,
						E_LiftCarDepth: this.entity.E_LiftCarDepth,
						E_LiftCarDoorH: this.entity.E_LiftCarDoorH,
						E_LiftCarDoorW: this.entity.E_LiftCarDoorW,
						E_LiftCarNetHeight: this.entity.E_LiftCarNetHeight,
						E_LiftCarType: this.entity.E_LiftCarType,
						E_LiftCarWidth: this.entity.E_LiftCarWidth,
						E_Load: this.entity.E_Load,
						E_MaxLiftHeight: this.entity.E_MaxLiftHeight,
						E_OpenDoorMode: this.entity.E_OpenDoorMode,
						E_RoomType: this.entity.E_RoomType,
						E_Speed: this.entity.E_Speed,
						Id: this.entity.Id,
						QSRDDetailsList: this.newQSRDDetailsList,
						RecordName: this.entity.RecordName
					}

				}
				// this.$set(this.entity, 'RecordName', RecordName)
				// newQSRDDetailsList.forEach((item, index)=>{
				// 	if(item.newId==null) newQSRDDetailsList.splice(index, 1)
				// })
				console.log('加入收藏列表了------', this.entity, newQSRDDetailsList, params)
				Elevator_Temp_QSRMSaveData(params).then(res => {
					if (res.Success) {
						this.$util.succesToast(this.options.title === "查看" ? '已保存' : '已加入收藏')
						setTimeout(function() {
							uni.navigateBack()
						}, 1500)

					} else {
						this.$util.toast(res.Msg)
					}
				})
			},
			searchClick() { //查询表格弹窗
				var that = this
				// 非空校验
				if (!this.entity.E_Load) return this.$util.toast('请选择载重')
				if (!this.entity.E_Speed) return this.$util.toast('请选择梯速')
				if (!this.entity.E_RoomType) return this.$util.toast('请选择机房类型')
				if (!this.entity.E_LiftCarType) return this.$util.toast('请选择轿厢类型')
				if (this.entity.E_Load && this.entity.E_LiftCarWidth && this.entity.E_LiftCarDepth) {
					ValidateLiftCarArea({
						E_Load: Number(this.entity.E_Load),
						E_LiftCarWidth: Number(this.entity.E_LiftCarWidth),
						E_LiftCarDepth: Number(this.entity.E_LiftCarDepth)
					}).then(res => {
						if (res.Success) {
							that.isValidateLiftCarArea = res.Data
							if (!res.Data) {
								that.$util.toast('轿厢面积校验不通过, 请重新输入轿厢宽高载重进行校验')
								// 延迟初始化为搜索按钮
								setTimeout(function() {
									that.isValidateLiftCarArea = true
								}, 5000)
								return
							}

							// 查询井道表格
							this.GetElevatorSampleInfoSuggestValue()
						}
					})
					return
				}
				console.log('查询不校验')
				this.isValidateLiftCarArea = true //默认显示查询按钮
				// 查询井道表格
				this.GetElevatorSampleInfoSuggestValue()
			},
			// 查询井道详情 不需要token
			getTheDataAndDetailForShare(Id) {
				this.tableData = []
				uni.showLoading({
					title: '加载中'
				})
				TheDataAndDetailForShare({
					id: Id
				}).then(res => {
					if (res.Success) {
						if (res.Data.QSRDDetailsList == 0) return this.$util.toast('暂无查询结果')
						res.Data.QSRDDetailsList.forEach((item, index) => {
							item.newId = index
						})
						uni.setStorageSync('tableData', res.Data.QSRDDetailsList)
						this.entity = res.Data
						console.log(this.entity)
						this.tableData = res.Data.QSRDDetailsList
						this.arrTableData = JSON.parse(JSON.stringify(this.tableData))
						this.newTableData = res.Data
						this.recommendMax(this
							.tableData
						) //计算每一列的最大值Object.keys(item).map(function(i){return item[i]}); //对象转化为数组
						console.log('获取详情结果', this.entity, this.tableData)

					}
				})
			},

			// 查询井道详情
			getTheDataAndDetail(Id) {
				this.tableData = []
				uni.showLoading({
					title: '加载中'
				})
				TheDataAndDetail({
					id: Id
				}).then(res => {
					if (res.Success) {
						this.newEntity = JSON.parse(JSON.stringify(res.Data));
						// if (res.Data.QSRDDetailsList == 0) return this.$util.toast('暂无查询结果')
						res.Data.QSRDDetailsList.forEach((item, index) => {
							item.newId = index
						})
						uni.setStorageSync('tableData', res.Data.QSRDDetailsList)
						this.entity = res.Data
						console.log(this.entity)
						this.tableData = res.Data.QSRDDetailsList
						this.arrTableData = JSON.parse(JSON.stringify(this.tableData))
						this.newTableData = res.Data
						this.recommendMax(this
							.tableData
						) //计算每一列的最大值Object.keys(item).map(function(i){return item[i]}); //对象转化为数组
						console.log('获取详情结果', this.entity, this.tableData)

					}
				})
			},

			// 查询井道计算表格数据
			GetElevatorSampleInfoSuggestValue() {
				this.tableData = []
				var that = this
				if (this.entity.E_Load) this.entity.E_Load = Number(this.entity.E_Load) //载重
				if (this.entity.E_Speed) this.entity.E_Speed = Number(this.entity.E_Speed) //梯速
				if (this.entity.E_MaxLiftHeight) this.entity.E_MaxLiftHeight = Number(this.entity
					.E_MaxLiftHeight) //提升最大高度
				if (this.entity.E_ShaftDepth) this.entity.E_ShaftDepth = Number(this.entity.E_ShaftDepth) //井道深度
				if (this.entity.E_ShaftWidth) this.entity.E_ShaftWidth = Number(this.entity.E_ShaftWidth) //井道宽度度
				if (this.entity.E_TopHeight) this.entity.E_TopHeight = Number(this.entity.E_TopHeight) //顶层高度度
				if (this.entity.E_LiftCarDoorH) this.entity.E_LiftCarDoorH = Number(this.entity
					.E_LiftCarDoorH) //开门高度
				if (this.entity.E_LiftCarDoorW) this.entity.E_LiftCarDoorW = Number(this.entity
					.E_LiftCarDoorW) //开门宽度
				if (this.entity.E_BottomDepth) this.entity.E_BottomDepth = Number(this.entity
					.E_BottomDepth) //底坑深度度
				uni.showLoading({
					title: '加载中'
				})
				ElevatorSampleInfoSuggestValue(this.entity).then(res => {
					if (res.Success) {
						this.newEntity = JSON.parse(JSON.stringify(this.entity));
						if (res.Data.length !== 0) {
							res.Data.forEach((item, index) => {
								item.newId = index
							})
							this.resetShow = true;
							uni.setStorageSync('tableData', res.Data)
							this.tableData = res.Data
							this.newTableData = JSON.parse(JSON.stringify(this.tableData))
							if (this.options.title === '查看') {
								delete this.entity.QSRDDetailsList
								this.entity.QSRDDetailsList = this.newTableData
								this.arrTableData = JSON.parse(JSON.stringify(this.entity.QSRDDetailsList))
							}
							let ErrorLiftHeight //提升高度
							let ECW_Prominent //对重类型
							let EOM_Prominent //开门方式
							// this.tableData.forEach((item => {
							// 	ErrorLiftHeight = item.ErrorLiftHeight
							// 	ECW_Prominent = item.ECW_Prominent
							// 	EOM_Prominent = item.EOM_Prominent
							// }))
							ErrorLiftHeight = this.tableData.some(item => item.ErrorLiftHeight == 1)
							ECW_Prominent = this.tableData.some(item => item.ECW_Prominent == 1)
							EOM_Prominent = this.tableData.some(item => item.EOM_Prominent == 1)
							console.log('是否顯示標題---------------------------------', ErrorLiftHeight,
								ECW_Prominent,
								EOM_Prominent)
							if (ErrorLiftHeight == 1 || ECW_Prominent == 1 || EOM_Prominent ==
								1) { //如果有一个为1 再弹窗 显示对应文字
								let obj = {
									ErrorLiftHeight: ErrorLiftHeight,
									ECW_Prominent: ECW_Prominent,
									EOM_Prominent: EOM_Prominent
								}
								this.$refs.UaPopup.open(obj)
							}

							this.recommendMax(this
								.tableData
							) //计算每一列的最大值Object.keys(item).map(function(i){return item[i]}); //对象转化为数组

						} else {
							this.$util.toast('暂无查询结果')
						}
					} else {
						uni.showToast({
							title: res.Msg
						})
					}
				})
			},
			//計算每一列的最大值
			recommendMax(tableData, type) {
				console.log('获取处理的数组', tableData, type)
				let newTableData = tableData.filter(item => item.IsShow == 1)
				console.log('获取处理的数组2', newTableData)
				if (newTableData.length == 0) return this.tableData = []

				let E_ShaftWidthArr = [] //井道宽度
				let E_ShaftDepthArr = [] //井道深度
				let E_TopHeightArr = [] //顶层高度
				let E_BottomDepthArr = [] //底坑深度
				let arr = newTableData.map(item => {
					return {
						E_ShaftWidth: item.E_ShaftWidth,
						E_ShaftDepth: item.E_ShaftDepth,
						E_TopHeight: item.E_TopHeight,
						E_BottomDepth: item.E_BottomDepth,
					}
				})
				arr.forEach((item, index) => {
					let E_ShaftWidthObj = {
						id: index,
						value: item.E_ShaftWidth
					}
					let E_ShaftDepthObj = {
						id: index,
						value: item.E_ShaftDepth
					}
					let E_TopHeightObj = {
						id: index,
						value: item.E_TopHeight
					}
					let E_BottomDepthObj = {
						id: index,
						value: item.E_BottomDepth
					}
					E_ShaftWidthArr.push(E_ShaftWidthObj)
					E_ShaftDepthArr.push(E_ShaftDepthObj)
					E_TopHeightArr.push(E_TopHeightObj)
					E_BottomDepthArr.push(E_BottomDepthObj)
				})
				// console.log('获取拼接---', E_ShaftWidthArr)
				// console.log('获取拼接---', E_ShaftDepthArr)
				// console.log('获取拼接---', E_TopHeightArr)
				// console.log('获取拼接---', E_BottomDepthArr)
				// console.log('获取拼接---', E_LiftCarDoorWArr)
				// console.log('获取拼接---', E_LiftCarDoorHArr)
				// console.log('获取拼接---', E_MaxLiftHeightArr)
				const E_ShaftWidthMax = this.$Enumerable.from(E_ShaftWidthArr).max(item => item.value);
				const E_ShaftDepthMax = this.$Enumerable.from(E_ShaftDepthArr).max(item => item.value);
				const E_TopHeightMax = this.$Enumerable.from(E_TopHeightArr).max(item => item.value);
				const E_BottomDepthMax = this.$Enumerable.from(E_BottomDepthArr).max(item => item.value);
				// console.log('获取遍历出来的1',E_ShaftWidthArr, E_ShaftWidthMax)
				// console.log('获取遍历出来的2',E_ShaftDepthArr, E_ShaftDepthMax)
				// console.log('获取遍历出来的3',E_TopHeightArr, E_TopHeightMax)
				// console.log('获取遍历出来的4',E_BottomDepthArr, E_BottomDepthMax)
				// console.log('获取遍历出来的5',E_LiftCarDoorWArr, E_LiftCarDoorWMax)
				// console.log('获取遍历出来的6',E_LiftCarDoorHArr, E_LiftCarDoorHMax)
				// console.log('获取遍历出来的7',E_MaxLiftHeightArr, E_MaxLiftHeightMax)
				// this.tableData.forEach()
				let itemObj = {
					E_Brand: "推荐值",
					E_Series: "",
					E_ShaftWidth: E_ShaftWidthMax,
					E_ShaftDepth: E_ShaftDepthMax,
					E_TopHeight: E_TopHeightMax,
					E_BottomDepth: E_BottomDepthMax,
					E_CounterWeight: "",
					E_OpenDoorMode: "",
					IsShow: 1,
					newId: null
				}
				if (type === '删除') this.tableData.shift()
				this.tableData.unshift(itemObj)
				console.log('获取推荐值', this.tableData, itemObj)
			}


			//获取盒子高度
			// getBoxHeight() {
			// 	uni.createSelectorQuery()
			// 		.in(this)
			// 		.select('.table-header')
			// 		.boundingClientRect(rect => {
			// 			if (rect) {
			// 				this.boxHeight = rect.height;
			// 			}
			// 		})
			// 		.exec();
			// },

		}
	}
</script>

<style lang="scss" scoped>
	.shaft {
		.noneActive {
			color: #d1100b;
		}

		.uni-row {
			.uni-tag-left {
				text-align: center;
				flex: 5
			}

			.uni-tag-right {
				flex: 5;
				text-align: center;
				font-size: 30rpx;
				border-radius: 10rpx;
				border: 1px solid #ccc;
				padding: 8rpx 0;
				margin-right: 20rpx;
			}

			.uni-tag-right.noneActive {
				// opacity: 0.4;
			}

			.uni-tag-right.active {
				background-color: #d1100b !important;
				color: #fff !important;
			}
		}

		.addbutton.active {
			background-color: #ccc !important;
			opacity: 0.6;
		}

		.search.active {
			background-color: #ccc !important;
			opacity: 0.6;
		}

		.addbutton {
			background-color: #D1100B;
			color: #fff;
		}

		.search {
			padding: 15rpx 30rpx;
			font-size: 30rpx;
			color: #fff;
			text-align: center;
			border-radius: 10rpx;
			background-color: #d1100b;
		}

		.backActive {
			background-color: #ccc !important;
			color: #5D5D5D !important;
		}

		.table-header {
			position: sticky;
			left: 0;
			top: 0;
			z-index: 99999;
			background-color: #fff;
		}

		.cate-btnBox {
			position: fixed;
			width: 100%;
			bottom: 0;
			z-index: 99;
			height: 98rpx;
			padding: 20rpx 0rpx;
			padding-bottom: calc(constant(safe-area-inset-bottom) + 20rpx);
			padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx);

			button {
				width: 100%;
			}

			.btn {
				background-color: #d1100b;
				color: #ffffff;
				margin-bottom: 6rpx;
			}

			// .plain {
			//   background-color: #ffffff;
			//   color: $theme;
			//   margin: 0;
			//   margin-bottom: 6upx;
			//   &:after {
			//     border-color: $theme;
			//   }
			//   &.button-hover {
			//     color: rgba($color: $theme, $alpha: 0.6);
			//     background-color: #ffffff;
			//   }
			// }
		}

	}
</style>